<link type="text/css" rel="stylesheet" href="{url:#css/ucenter.css}" />
{echo:JS::import('form');}
{echo:JS::import('date');}
{echo:JS::import('dialog?skin=tinysimple');}
{echo:JS::import('editor');}
{echo:JS::import('dialogtools');}

<script>
    var editor;
    KindEditor.ready(function(K) {
      editor = K.create('textarea[name="dp_content"],textarea[name="sale_protection"]', {
        uploadJson : '{url:/ucenter/upload_image}'
      });
    });
</script>
<script type="text/javascript" charset="UTF-8" src="{url:#js/jquery.iframe-post-form.js}"></script>
<div class="container clearfix">
	{widget:name=sub_navs action=ucsidebar sidebar=$sidebar act=$actionId}
	<div class="content clearfix uc-content">
		<h1 class="title"><span>我的店铺：</span></h1>
		{if:isset($msg)}
		<div class="message_{$msg[0]} ie6png">{$msg[1]}</div>
		{elseif:isset($validator)}
		<div class="message_warning ie6png">{$validator['msg']}</div>
		{/if}
		<div class="mt10" style="position:relative;">
			<div class="tab"><ul class="tab-head"><li>店铺信息<i></i></li><li>修改信息<i></i></li></ul>
			<div class="tab-body">
			<!-- 店铺信息 -->
			<div class='p10'>
				<table class="simple">
						<tr><th width="120">申请时间</th><td>{$info['sq_time']}</td></tr>
						<tr><th width="120">名称</th><td>{$info['dp_name']}</td></tr>
						<tr><th width="120">机构代码</th><td>{$info['dp_dm']}</td></tr>
						<tr><th width="120">固定电话</th><td>{$info['dp_tel']}</td></tr>
						<tr><th width="120">所属行业</th><td>{echo:Zyk_tj::zyk_info('goods_category',$info['category_id'],'name')}</td></tr>
						<tr><th width="120">所在地区</th><td>{echo:Zyk_tj::zyk_info('area',$info['province'],'name')} - {echo:Zyk_tj::zyk_info('area',$info['city'],'name')} - {echo:Zyk_tj::zyk_info('area',$info['county'],'name')}</td></tr>
						<tr><th width="120">详细地址</th><td>{$info['dp_addr']}</td></tr>
						<tr><th width="120">申请类型</th>
						<td>
						<span class="red">{echo:Zyk_tj::zyk_info('qylx',$info['dp_lx'],'name')}</span>&nbsp;&nbsp;{echo:Zyk_tj::zyk_info('qylx',$info['dp_lx'],'money')}/年&nbsp;&nbsp;{echo:Zyk_tj::zyk_info('qylx',$info['dp_lx'],'sm')}
						</td></tr> 
						<tr><th width="120">审核时间</th><td>{$info['sh_time']}</td></tr>
						<tr><th width="120">当前状态</th><td>{echo:$info['is_ok']==1?'审核中':'已审核';}</td></tr>
					</table>
			</div>
			<!-- 修改信息 -->
			<div class='p10'>
			<form id="info-form" class="simple" action="{url:/ucenter/dp_mod}" method="post" enctype="multipart/form-data" callback="check_invalid">
				<table class="form">
					<tr>
						<td class="label">名称：</td><td><input type="text" pattern="required" name="dp_name" value="{$info['dp_name']}" readonly> <label></label></td>
					</tr>
					
					<tr>
						<td class="label">机构代码：</td><td><input type="text" pattern="required" name="dp_dm" value="{$info['dp_dm']}" readonly><label></label></td>
					</tr>
					<tr>
						<td class="label">联系电话(固定)：</td><td><input type="text" pattern="phone" name="dp_tel" alt="请填写固定电话" value="{$info['dp_tel']}"><label></label></td>
					</tr>
					<tr>
						<td class="label">申请类型：</td>
						<td>
						{echo:Zyk_tj::zyk_info('qylx',$info['dp_lx'],'name')}</span>&nbsp;&nbsp;{echo:Zyk_tj::zyk_info('qylx',$info['dp_lx'],'money')}/年&nbsp;&nbsp;{echo:Zyk_tj::zyk_info('qylx',$info['dp_lx'],'sm')}
				        </td>
					</tr>
					<tr>
						<td class="label">行业类别：</td><td>
				<select name="category_id" id="category_id" pattern="[1-9]\d*" alt="请选择行业类别">
              <option value="0">选择行业</option>
              {query:name=goods_category where=parent_id eq 0}
                    <option value="{$item['id']}" {if:$info['category_id']==$item['id']}selected{/if}>{$item['name']}</option>
              {/query}
            </select>
						<label></label></td>
					</tr>
					<tr><td class="label">所在地区：</td><td id="area"><select id="province"  name="province" >
						<option value="0">==省份/直辖市==</option>
					</select>
					<select id="city" name="city"><option value="0">==市==</option></select>
					<select id="county" name="county"><option value="0">==县/区==</option></select><input pattern="^\d+,\d+,\d+$" id="test" type="text" style="visibility:hidden;width:0;" value="{$info['province']},{$info['city']},{$info['county']}" alt="请选择完整地区信息！"><label></label></td></tr>
					<tr>
						<td class="label">地址：</td><td><textarea name="addr" pattern="required" minlen="5" maxlen="120" alt="不需要重复填写省市区，必须大于5个字符，小于120个字符">{$info['dp_addr']}</textarea> <label>不需要重复填写省市区，必须大于5个字符，小于120个字符</label></td>
					</tr>{set:$path = Tiny::getPath('uploads_url');}
					<tr><td class="label">LOGO：</td>
					<td><input name="dp_logo" type="hidden" id="dp_logo" value="{$info['dp_logo']}" /><label></label><button class="button select_button" type="button">选择上传LOGO</button><div id="img-show">{if:isset($info['dp_logo']) && $info['dp_logo']!=''}
            <img height="100" src="{url:@$info[dp_logo]}">{/if}</div></td>
					</tr>
					<tr>
						<td class="label">简介：</td>
						<td><textarea id="dp_content" pattern="required" name="dp_content" style="width:700px;height:360px;visibility:hidden;">{$info['dp_content']}</textarea></td>
					</tr>
					<tr>
						<td colspan="2" class="tc"><input type="submit" class="btn" value="提交"></td>
					</tr>
				</table>
			</form>
			</div>
			</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	var form =  new Form('info-form');

	form.setValue('is_default','{$is_default}');
	$("#areas").Linkage({ url:"{url:/ajax/area_data}",selected:[{$info['province']|0},{$info['city']|0},{$info['county']|0}],callback:function(data){
		var text = new Array();
		var value = new Array();
		for(i in data[0]){
			if(data[0][i]!=0){
				text.push(data[1][i]);
				value.push(data[0][i]);
			}
		}
		$("#test").val(value.join(','));
		FireEvent(document.getElementById("test"),"change");
	}});
	{if:isset($invalid)}
	autoValidate.showMsg({id:$("input[name='{$invalid['name']}']").get(0),error:true,msg:'{$invalid['msg']}'});
	{/if}
</script>
<script>
$(".select_button").on("click",function(){
      uploadFile();
      return false;
    });
function uploadFile(){
  art.dialog.open('{url:/ucenter/photoshop?type=10}',{id:'upimg_dialog',title:'选择图片',width:613,height:380});
}
function setImg(value){
  $("#dp_logo").val(value);
  $("#img-show").html("<img height='100' src='{url:@}"+value+"'>");
  art.dialog({id:'upimg_dialog'}).close();
}
function check_invalid(e){
  if(e==null){
    return true;
  }
  else{
    var index = $('.tab-body > *').has(e).index();
    tabs_select(0,index);
    return false;
  }  
}
</script>